#-*-Makefile-*- vim:syntax=make

### ---
### --- Set standard defaults for user-definable variables
### ---

OPTFLAGS ?= -Os

NESC_FLAGS ?= -Wnesc-all -fnesc-include=tos
NESC_SCHEDULER ?= TinySchedulerC,TinySchedulerC.TaskBasic,TaskBasic,TaskBasic,runTask,postTask
NESC_CFILE ?= $(TOSMAKE_BUILD_DIR)/app.c
NESC_SEPARATOR ?= __

# Add the standard TinyOS source directories to the build search path
TOSMAKE_PFLAGS_STD_INCLUDE ?= -I%T/system -I%T/types -I%T/interfaces

### ---
### --- Set common variables that are local to the Make system that are used in
### --- many .rules files.
### ---

# Setup variables for the common output files. Not all toolchains may use all
# these, but this way not all .rules files have to set all of them.
TOSMAKE_BUILD_DIR ?= build/$(TARGET)
MAIN_EXE  = $(TOSMAKE_BUILD_DIR)/main.exe
MAIN_LST  = $(TOSMAKE_BUILD_DIR)/main.lst
MAIN_SYM  = $(TOSMAKE_BUILD_DIR)/main.sym
MAIN_MAP  = $(TOSMAKE_BUILD_DIR)/main.map
MAIN_IHEX = $(TOSMAKE_BUILD_DIR)/main.ihex
MAIN_BIN  = $(TOSMAKE_BUILD_DIR)/main.bin
MAIN_SREC = $(TOSMAKE_BUILD_DIR)/main.srec
MAIN_ELF  = $(TOSMAKE_BUILD_DIR)/main.elf

# Default applications
SET_ID ?= tos-set-symbols
NESC ?= nescc

# Variable name to be replaced when a NODEID is set
TOSMAKE_AMADDR_STR ?= ActiveMessageAddressC__addr
TOSMAKE_TOS_NODE_ID_STR ?= TOS_NODE_ID

# Cause Makerules to include more .extra files
GOALS += tos_image tos_buildinfo tosboot

define DEFAULT_HELP

 Welcome to the TinyOS make system!

 You must specify one of the valid targets and possibly some combination of
 the extra options.  Many targets have custom extras and extended help, so be
 sure to try "make <target> help" to learn of all the available features.

 Global extras:

   docs    : compile additional nescdoc documentation
   tinysec : compile with TinySec secure communication

endef
HELP += $(DEFAULT_HELP)

